package com.thinkingstar.iads.projectcenter.entity.dao;

import com.thinkingstar.iads.common.serviceImpl.EntityRepositoryServiceImpl;
import com.thinkingstar.iads.projectcenter.entity.PcProjectEquipmentSelfCheckResult;
import com.thinkingstar.iads.projectcenter.entity.PcSjpsFile;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Criteria;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;

import java.util.ArrayList;
import java.util.List;


/**
 * @ClassName: DaoPcEquipmentSelfCheckResult
 * @Description:项目设备自检结果
 * @author z
 */
@IocBean(args = {"refer:dao"})
public class DaoPcEquipmentSelfCheckResult extends EntityRepositoryServiceImpl<PcProjectEquipmentSelfCheckResult>{

    public DaoPcEquipmentSelfCheckResult(Dao dao) {
        super(dao);
    }
    
    //根据项目查询自检结果
    public QueryResult findResultByProjectId(NutMap param){
    	List <PcProjectEquipmentSelfCheckResult> list = new ArrayList<>();
    	Pager pager = null;
    	Criteria criteria = Cnd.NEW();
    	criteria.where().and("del_flag", "=", false).and("project_id", "=", param.getString("project_id"));
    	if(param.get("page_num") != null && param.get("page_size") != null){
    		pager = new Pager(param.getInt("page_num"),param.getInt("page_size"));
    		pager.setRecordCount(count(criteria));
    		list = query(criteria, pager);
    		return new QueryResult(list, pager);
    	}
    	list = query(criteria);
    	return new QueryResult(list,pager);
    }
    

}
